package cn.jia.hrm.controller;

import cn.jia.hrm.AjaxResult;
import cn.jia.hrm.service.IVerifycodeService;
import cn.jia.hrm.vo.SMScode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {

    @Autowired
    private IVerifycodeService iVerifycodeService;
    @GetMapping("/imageCode/{key}")
    public AjaxResult verifycode(@PathVariable String key){
        System.out.println(key);
        String img = iVerifycodeService.getimg(key);
        return AjaxResult.me().setResultObj(img);
    }

    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody SMScode smScode){
        iVerifycodeService.sendSmsCode(smScode);
        return AjaxResult.me();
    }
}
